/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "pyivtbtipotras")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pyivtbtipotras.findAll", query = "SELECT p FROM Pyivtbtipotras p"),
    @NamedQuery(name = "Pyivtbtipotras.findByPyivtbtipotrasid", query = "SELECT p FROM Pyivtbtipotras p WHERE p.pyivtbtipotrasid = :pyivtbtipotrasid"),
    @NamedQuery(name = "Pyivtbtipotras.findByNombre", query = "SELECT p FROM Pyivtbtipotras p WHERE p.nombre = :nombre")})
public class Pyivtbtipotras implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "pyivtbtipotrasid")
    private Integer pyivtbtipotrasid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "nombre")
    private String nombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyivtbtipotrasid")
    private Collection<Pyivtbtrasutiles> pyivtbtrasutilesCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyivtbtipotrasid")
    private Collection<Pyivtbtrasinv> pyivtbtrasinvCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyivtbtipotrasid")
    private Collection<Pyivtbtrasmob> pyivtbtrasmobCollection;

    public Pyivtbtipotras() {
    }

    public Pyivtbtipotras(Integer pyivtbtipotrasid) {
        this.pyivtbtipotrasid = pyivtbtipotrasid;
    }

    public Pyivtbtipotras(Integer pyivtbtipotrasid, String nombre) {
        this.pyivtbtipotrasid = pyivtbtipotrasid;
        this.nombre = nombre;
    }

    public Integer getPyivtbtipotrasid() {
        return pyivtbtipotrasid;
    }

    public void setPyivtbtipotrasid(Integer pyivtbtipotrasid) {
        this.pyivtbtipotrasid = pyivtbtipotrasid;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @XmlTransient
    public Collection<Pyivtbtrasutiles> getPyivtbtrasutilesCollection() {
        return pyivtbtrasutilesCollection;
    }

    public void setPyivtbtrasutilesCollection(Collection<Pyivtbtrasutiles> pyivtbtrasutilesCollection) {
        this.pyivtbtrasutilesCollection = pyivtbtrasutilesCollection;
    }

    @XmlTransient
    public Collection<Pyivtbtrasinv> getPyivtbtrasinvCollection() {
        return pyivtbtrasinvCollection;
    }

    public void setPyivtbtrasinvCollection(Collection<Pyivtbtrasinv> pyivtbtrasinvCollection) {
        this.pyivtbtrasinvCollection = pyivtbtrasinvCollection;
    }

    @XmlTransient
    public Collection<Pyivtbtrasmob> getPyivtbtrasmobCollection() {
        return pyivtbtrasmobCollection;
    }

    public void setPyivtbtrasmobCollection(Collection<Pyivtbtrasmob> pyivtbtrasmobCollection) {
        this.pyivtbtrasmobCollection = pyivtbtrasmobCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pyivtbtipotrasid != null ? pyivtbtipotrasid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pyivtbtipotras)) {
            return false;
        }
        Pyivtbtipotras other = (Pyivtbtipotras) object;
        if ((this.pyivtbtipotrasid == null && other.pyivtbtipotrasid != null) || (this.pyivtbtipotrasid != null && !this.pyivtbtipotrasid.equals(other.pyivtbtipotrasid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Pyivtbtipotras[ pyivtbtipotrasid=" + pyivtbtipotrasid + " ]";
    }
    
}
